<%@ page contentType="text/html; charset=utf-8"%>
<%@ include file="/jsp/inc/header.jsp" %>
<c:set var="title" value="专题"/>
<c:set var="rootpath" value="${CONTEXT_PATH}/admin/article/special/"/>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="${STATIC_HOST}/css/ligerui.css" rel="stylesheet" type="text/css"/>
    <link href="${STATIC_HOST}/css/common.css" rel="stylesheet" type="text/css" />
	<link href="${STATIC_HOST}/js/uploadify/uploadify.css" rel="stylesheet" type="text/css"/>

	<script src="${STATIC_HOST}/js/common-1.7.js" type="text/javascript"></script>
	<script src="${STATIC_HOST}/js/LG.js" type="text/javascript"></script>
	<script src="${STATIC_HOST}/js/uploadify/jquery.uploadify-3.1.min.js" type="text/javascript"></script>
    <title>${title}管理</title>
</head>
<body>
<form:form commandName="special" class="l-form" id="mainform" name="mainform" method="post" action="${rootpath}/save.do">
  <div class="l-group l-group-hasicon"><img src="${STATIC_HOST}/images/common/communication.gif"><span>当前位置: 宇宙CMS &gt; <a href="${rootpath}/list.do">${title}管理</a> &gt; ${special.id==0 ? '新增' : '修改'}${title}</span></div>
    <div id="errorLabelContainer"> <form:errors path="*"/></div>
        <input type="hidden" name="queryParam" value="${queryParam}"/>
		<input type="hidden" name="id" id="id" value="${special.id}"/>
		
      <ul>
		  <li class="li_show_left" style="padding-left:30px;"><label for="title">专题标题</label> <span style="color:red">*</span>:</li>
			   <li class="li_show_right">
			<input type="text" name="title" id="title" size="60" maxlength="100" ltype='text'  validate="{required:true,minlength:0,maxlength:100}" value="${special.title}"/>
		   <span class='formValidatorError'><form:errors path="title" /></span>
		  </li>
		  <li class="li_show_left" style="padding-left:30px;"><label for="code">专题代号</label> <span style="color:red">*</span>:</li>
			   <li class="li_show_right">
			<input type="text" name="code" id="code" size="60" maxlength="100" ltype='text'  validate="{required:true,minlength:0,maxlength:100}" value="${special.code}"/>
		   <span class='formValidatorError'><form:errors path="code" /></span>
		  </li>
      </ul><!--换行-->
      <ul>
		  <li class="li_show_left" style="padding-left:30px;"><label for="siteId">站点ID</label> <span style="color:red">*</span>:</li>
		  <li class="li_show_right">
			  <input type="text" name="siteId" id="siteId" size="10" ltype='text' ligerui='{"width":155}'  value="${special.siteId}"/>
			  <input value="..." type="button" class="l-button ellipsis"  onclick="f_select({'targetId':'siteId','selectType':'/admin/site/site'})">
			  <span class='formValidatorError'><form:errors path="siteId" /></span>
		  </li>
		  <li class="li_show_left" style="padding-left:30px;"><label for="channelId">频道ID</label> <span style="color:red">*</span>:</li>
		  <li class="li_show_right">
			  <input type="text" name="channelId" id="channelId" size="10" ltype='text' ligerui='{"width":155}'  value="${special.channelId}"/>
			  <input value="..." type="button" class="l-button ellipsis"  onclick="f_select({'targetId':'channelId','selectType':'/admin/site/channel'})">
			  <span class='formValidatorError'><form:errors path="channelId" /></span>
		  </li>
      </ul><!--换行-->
      <ul>
		  <li class="li_show_left" style="padding-left:30px;"><label for="thumbPicUrl">缩略图</label>:</li>
			   <li class="li_show_right">
		    <input type="text" name="thumbPicUrl" id="thumbPicUrl" size="60" maxlength="100" ltype='text'  validate="{required:true,minlength:0,maxlength:100}" value="${special.thumbPicUrl}"/><br/>
		    <img id="preview" src="http://img011.21cnimg.com/images/error/1px.png" />
		    <input type="file" name="file" id="file"/>
		  </li>
		  <li class="li_show_left" style="padding-left:30px;"><label for="status">状&nbsp;&nbsp;态</label> <span style="color:red">*</span>:</li>
		  <li class="li_show_right">
			  <select name="status" id="status" ltype="select" size="1" >
				  <c:forEach var="obj" items="${statusMap}" varStatus="idx">
					  <option value="${obj.key}" <c:if test="${special.status==obj.key}">selected</c:if>>${obj.value}</option>
				  </c:forEach>
			  </select>
		  </li>
      </ul><!--换行-->
	<div class="l-group l-group-hasicon"><div class="togglebtn togglebtn-left"></div><span>模板信息</span><div class="togglebtn"></div></div><!--分组-->
	<div class="div-group">
		<ul>
			<li class="li_show_left" style="padding-left:30px;">
				<input value="通用模板" type="button" class="l-button"  onclick="f_select({'targetId':'templateContent','javaView':'generalTemplate','selectType':'/admin/article/special','jspPage':'generalTemplate'})">
			</li>
			<li class="li_show_right">
				<textarea name="templateContent" id="templateContent" rows="3" cols="80" class="l-textarea" style="width: 560px; height: 300px;">${special.templateContent}</textarea>
			</li>
			<li class="li_show_right">
				<input value="预览" id="previewSpecial" class="l-button l-button-submit form_submit_button" onclick="return previewSp(this.form);" type="button">
			</li>
		</ul><!--换行-->
	</div>
	<div class="l-group l-group-hasicon"><div class="togglebtn togglebtn-left"></div><span>扩展信息</span><div class="togglebtn"></div></div><!--分组-->
	<div class="div-group">
      <ul>
		  <li class="li_show_left" style="padding-left:30px;"><label for="keyword">SEO关键词</label> <span style="color:red">*</span>:</li>
			   <li class="li_show_right">
			<input type="text" name="keyword" id="keyword" size="100" maxlength="100" ltype='text'  validate="{required:true,minlength:0,maxlength:100}" value="${special.keyword}"/>（以,分开）
		   <span class='formValidatorError'><form:errors path="keyword" /></span>
		  </li>
      </ul><!--换行-->
      <ul>
		  <li class="li_show_left" style="padding-left:30px;"><label for="description">SEO描述</label> <span style="color:red">*</span>:</li>
			   <li class="li_show_right">
		    <textarea name="description" id="description" rows="2" cols="80" class="l-textarea" validate="{minlength:0,maxlength:420}">${special.description}</textarea>
		   <span class='formValidatorError'><form:errors path="description" /></span>
		  </li>
      </ul><!--换行-->
      <ul>
		  <li class="li_show_left" style="padding-left:30px;"><label for="memo">备注</label> <span style="color:red">*</span>:</li>
			   <li class="li_show_right">
				   <textarea name="memo" id="memo" rows="2" cols="80" class="l-textarea" validate="{minlength:0,maxlength:420}">${special.memo}</textarea>
				   <span class='formValidatorError'><form:errors path="memo" /></span>
		  </li>
      </ul><!--换行-->
	</div>

  <div class="l-group l-group-hasicon"></div> 
  <input type="submit" value="提交" id="mainformsubmit" class="l-button l-button-submit form_submit_button"/> 
  <c:if test="${fn:contains(header.referer,rootpath)}"><input type="button" value="返回" class="l-button l-button-test" style="float:left;" onClick="location.href='${header.referer}'" /></c:if>
</form:form>
<script type="text/javascript" >
var mainform = $("#mainform");
mainform.ligerForm();

function previewSp(frm){
	if($("#templateContent").val()==""){
		$.ligerDialog.error('请填写模板内容');
		return false;
	}
	frm.target="_blank";
	frm.action="/admin/article/special/preview.do";
	frm.submit();
	frm.target="_self";//还原
	frm.action="${rootpath}/${special.id==0 ? 'save' : 'update'}.do";
}

$('#file').uploadify({
	'swf':'/js/uploadify/uploadify.swf',
	'uploader':'${STATIC_HOST}/upload.do',
	'buttonText':'上传图片',
	'formData':{'uploadHandler':'pictureUploadHandler'},
	'fileTypeDesc':'支持格式:jpg/gif/jpeg/png.', //如果配置了以下的'fileExt'属性，那么这个属性是必须的
	'fileTypeExts':'*.jpg;*.gif;*.jpeg;*.png;', //允许的格式
	'fileSizeLimit':'50MB',
	'onUploadSuccess':function (file, data, response) {
		var uploadImg = eval('(' + data + ')');
		if (uploadImg.SUCCESS[0].url) {
			$('#thumbPicUrl').attr('src', uploadImg.SUCCESS[0].url);
		}
	}
});

$('#file').uploadify({
	'swf':'/js/uploadify/uploadify.swf',
	'uploader':'${STATIC_HOST}/upload.do',
	'buttonText':'上传图片',
	'formData':{'type':'1', 'appKey':'d8dac30e-b16a-46db-a4e8-8ff6f283aa0b'},
	'fileTypeDesc':'支持格式:jpg/gif/jpeg/png/bmp.', //如果配置了以下的'fileExt'属性，那么这个属性是必须的
	'fileTypeExts':'*.jpg;*.gif;*.jpeg;*.png;*.bmp;', //允许的格式
	'fileSizeLimit':'10MB',
	'multi':true,
	'onUploadSuccess':function (file, data, response) {
		var uploadImg = eval('(' + data + ')');
		if (uploadImg.SUCCESS[0].url) {
			$('#preview').attr('src', uploadImg.SUCCESS[0].url);
			$('#preview').attr('width','150px');
			$('#thumbPicUrl').val(uploadImg.SUCCESS[0].url);
		}
	}
});

function formatC(right_1_rc, right_2_rc, left_1_rc, left_2_rc, right_1_id, right_2_id, left_1_id, left_2_id, siteFileId, picurl){
	$.post("${rootpath}/generalTemplate.do",
			{
				right_1_rc: right_1_rc,
				right_2_rc: right_2_rc,
				left_1_rc: left_1_rc,
				left_2_rc: left_2_rc,
				right_1_id: right_1_id,
				right_2_id: right_2_id,
				left_1_id: left_1_id,
				left_2_id: left_2_id,
				siteFileId: siteFileId,
				picurl:picurl
			},function(data){
				data = data.trim(data);
				jQuery("#templateContent").val(data);
				LG.tip("亲，成功生成专题模版内容");
			});
	f_selectCancel();
}

</script>
<div id="scrolltop">返回顶部</div>
<%@ include file="/jsp/inc/footer.jsp"%>
</body>
</html>